package model

// 验证码
type CodeMailReq struct {
	Email string `form:"email" json:"email"`
}

type CaptchaRequest struct {
	Time int64 `form:"time" json:"time" validate:"required"`
	Rand uint  `form:"rand" json:"rand" validate:"required"`
}

// 图片验证码
type CaptChaResponse struct {
	Code string `json:"code"`
	Img  string `json:"img"`
}

// 忘记密码
type ForgetPasswordReq struct {
	Email       string `form:"email" json:"email"`
	DynamicCode string `form:"dynamic_code" json:"dynamic_code"`
}

// 修改密码
type UpdatePasswordReq struct {
	UserId          uint   `form:"user_id" json:"user_id"`
	OldPassword     string `form:"old_password" json:"old_password"`
	NewPassword     string `form:"new_password" json:"new_password"`
	ConfirmPassword string `form:"confirm_password" json:"confirm_password"`
}

// 后台账户登录
type SendCodeRequest struct {
	Action    string `json:"action" validate:"required"`
	Phone     string `json:"phone"`
	Token     string `json:"token"`
	UserName  string `json:"username"`
	ClientId  string `json:"client_id"`
	GrantType string `json:"grant_type"`
	Password  string `json:"password"`
	Code      string `json:"code"`
}

type MailSendCodeRequest struct {
	Mail string `json:"mail" validate:"required,email"`
}

// 手机号账户
type PhLogin struct {
	Code  string `from:"code" json:"code" validate:"required"`
	Phone string `from:"phone" json:"phone" validate:"required"`
}

// 微信账户
type WxLogin struct {
	Code string `from:"code" json:"code" validate:"required"`
}

// 学校账户登录
type ScLogin struct {
	Code     string `from:"code" json:"code" validate:"required"`
	Time     int64  `form:"time" json:"time" validate:"required"`
	Rand     uint   `form:"rand" json:"rand" validate:"required"`
	School   string `from:"school" json:"school" validate:"required"`
	SchoolId uint   `from:"school_id" json:"schoolId"`
	Sno      string `from:"sno" json:"sno" validate:"required"`
	Password string `from:"password" json:"password" validate:"required"`
}

// 大学小程序跳过来免密登录
type ExLogin struct {
	Token     string `from:"token" json:"token" validate:"required"`
	ClientId  string `form:"client_id" json:"client_id" validate:"required"`
	GrantType string `form:"grant_type" json:"grant_type" validate:"required"`
}

// 小程序登录
type LoginRequest struct {
	Type      string   `from:"type" json:"type" validate:"required"`
	Ph        *PhLogin `json:"ph"`
	Wx        *WxLogin `json:"wx"`
	Sc        *ScLogin `json:"sc"`
	Ex        *ExLogin `json:"ex"`
	PromoteId string   `from:"promote_id"  json:"promote_id"`
}

type UserInfoRequest struct {
	Uid        int    `json:"uid" form:"uid" uri:"uid"`
	Name       string `json:"name" form:"name"`
	School     string `json:"school" form:"school"`
	Profession string `json:"profession" form:"profession"`
	Grade      string `json:"grade" form:"grade"`
}

// 绑定手机号
type BindingPhone struct {
	Phone string `from:"phone" json:"phone" validate:"required"`
}

// 绑定手机号
type BindingSync struct {
	IsSync bool `form:"is_sync" json:"is_sync"`
}

// 绑定邮箱
type BindingMail struct {
	Mail string `json:"mail" form:"mail" validate:"email"`
	Code string `json:"code" from:"code" validate:"required"`
}

// 小程序-邮箱找回密码
type PwdResetFind struct {
	Mail       string `json:"mail" form:"mail" validate:"email"`
	NewPwd     string `json:"new_pwd" form:"new_pwd" validate:"required"`
	ConfirmPwd string `json:"confirm_pwd" form:"confirm_pwd" validate:"required"`
}

// 小程序密码重置
type PwdReset struct {
	NewPwd     string `json:"new_pwd" form:"new_pwd" validate:"required"`
	ConfirmPwd string `json:"confirm_pwd" form:"confirm_pwd" validate:"required"`
}

// 返回类
type LoginResp struct {
	Id            int    `json:"id"`
	Token         string `json:"token"`
	IsFirstLogin  bool   `json:"is_first_login"`
	Theme         string `json:"theme"`
	CanUseApplets bool   `json:"can_use_applets"`
}

// 后台登录返回类
type AdminLoginResp struct {
	Id           int    `json:"id"`
	Name         string `json:"name" `
	School       string `json:"school"`
	Profession   string `json:"profession"`
	Grade        string `json:"grade"`
	Education    string `json:"education"`
	Type         string `json:"type"`
	Phone        string `json:"phone"`
	Sno          string `json:"sno"`
	Token        string `json:"token"`
	Academy      string `json:"academy"`
	ReportUrl    string `json:"report_url"`
	Level        int    `json:"level"`
	IsFirstLogin bool   `json:"is_first_login"`
	Mail         string `json:"mail"`
	Theme        string `json:"theme"`
}

// 当前会员信息
type UserMember struct {
	MemeberStartTime string `json:"member_start_time"`
	MemberStatus     bool   `json:"member_status"`
	MemeberTitle     string `json:"member_title"`
	MemberLevel      int    `json:"member_level"`
	MemberLevelStr   string `json:"member_level_str"`
	MemberExpire     string `json:"member_expire"`
	SurplusTime      int    `json:"surplus_time"`
}

// 当前用户的信息
type UserInfo struct {
	Id            int         `json:"id"`
	Sno           string      `json:"sno"`
	Name          string      `json:"name"`
	School        string      `json:"school"`
	Academy       string      `json:"academy"`
	Profession    string      `json:"profession"`
	Grade         string      `json:"grade"`
	Phone         string      `json:"phone"`
	Mail          string      `json:"mail"`
	Education     string      `json:"education"`
	Type          string      `json:"type"`
	MemberStatus  string      `json:"member_status"`
	ReportUrl     string      `json:"report_url"`
	Level         int         `json:"level"`
	IconUrl       string      `json:"icon_url"`
	Token         string      `json:"token"`
	UM            *UserMember `json:"member"`
	TrailCount    uint        `json:"trial_count"`
	IsSync        bool        `json:"is_sync"`
	AgentIsSync   bool        `json:"agent_is_sync"`
	CloseIcon     bool        `json:"close_icon"`
	CloseBanner   bool        `json:"close_banner"`
	OpenReport    bool        `json:"open_report"`
	CanUseApplets bool        `json:"can_use_applets"`
}

// 北大老师
type TeacherInfo struct {
	LoginName string `json:"loginName"`
	College   string `json:"college"`
}

// 添加企业信息
type EnterpriseInfo struct {
	Name   string `form:"name" json:"name" validate:"required"`
	Prefix string `form:"prefix" json:"prefix" validate:"required"`
	Opt    string `json:"opt" form:"opt" validate:"required||oneof=schame`
}

// 返回appkey 和 appsercet
type EnterpriseKey struct {
	AppKey    string `json:"app_key"`
	AppSecret string `json:"app_secret"`
}

// token 校验
type TokenVerifyReset struct {
	Token    string `json:"token" form:"token" validate:"required"`
	ClientId string `json:"client_id" form:"client_id" validate:"required"`
}

// 添加token访问的企业信息
type AddTokenReq struct {
	School      string `json:"school" validate:"required"`
	AccountName string `json:"account_name" validate:"required"`
	AgentId     int    `json:"agent_id"`
}
